package org.chronologger.poppaea.client.domain;

import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

@RemoteServiceRelativePath("chronosvc")
public interface ChronologyService extends RemoteService {

	/**
	 * Creates a new location on the server.
	 * 
	 * @param chronologyKey
	 * @return
	 */
	Location addLocation(Long chronologyKey);

	/**
	 * Adds a character to a scene
	 * 
	 * @param sceneKey
	 * @param characterKey
	 */
	void addPerson(Long sceneKey, Long characterKey);

	/**
	 * Creates a new scene for a location on the server.
	 * 
	 * @param locationKey
	 * @return the new scene
	 */
	Scene addScene(Long locationKey);

	/**
	 * Creates a new chronology on the server.
	 * 
	 * @param name
	 * @return
	 */
	ChronologyData createChronology(String name);

	/**
	 * Creates a new person linked to a chronology on the server.
	 * 
	 * @param chronologyKey
	 * @return
	 */
	Person createPerson(Long chronologyKey);

	/**
	 * Deletes a chronology
	 * 
	 * @param chronologyKey
	 */
	void deleteChronology(Long chronologyKey);

	/**
	 * Deletes a person
	 * 
	 * @param personKey
	 */
	void deletePerson(Long personKey);

	/**
	 * Returns a chronology by its Long.
	 * 
	 * @param name
	 * @return
	 */
	ChronologyData getChronology(Long chronologyKey);

	/**
	 * Deletes a location on the server.
	 * 
	 * @param locationKey
	 */
	void removeLocation(Long locationKey);

	/**
	 * Removes a character from a scene
	 * 
	 * @param sceneKey
	 * @param characterKey
	 */
	void removePerson(Long sceneKey, Long characterKey);

	/**
	 * Removes a scene from its location.
	 * 
	 * @param sceneKey
	 */
	void removeScene(Long sceneKey);

	/**
	 * Updates a location on the server. Does not update scenes at the location.
	 * 
	 * @param location
	 */
	void updateLocation(Location location);

	/**
	 * Updates a character on the server.
	 */
	void updatePerson(Person person);

	/**
	 * Updates a scene on the server. Does not update characters in scene.
	 * 
	 * @param scene
	 */
	void updateScene(Scene scene);
}
